<template>
	<view class="spbox">
		<view class="sp_box" :style="{height:box_height}">
			<view class="sp_item f" v-for="(item,index) in list" :key="index">
				<image :src="item.goods_image" mode="aspectFill"></image>
				<view class="msg f_d f_z_b">
					<view class="name text_ellipsis2">
						{{item.goods_title}}
					</view>
					<view class="gg">
						规格：{{item.item_name}}
					</view>
					<!-- <view class="time">
						发货时间：卖家承诺15天
					</view> -->
				</view>
				<view class="price f_d">
					<view class="text">
						￥{{item.goods_price}}
					</view>
					<view class="num">
						x{{item.goods_count}}
					</view>
					<view class="pl_btn" v-if="status==5 && item.is_common===0 && item.refund==0"
						@click.stop="go(`/pages/order/pl_sub?id=${item.id}`)">
						商品评价
					</view>
				</view>
			</view>
		</view>
		<view class="all f_zj" @click.stop="all_click" v-if="list.length>1">
			<view class="text">
				{{see_all?'收起':'查看全部商品'}}
			</view>
			<image v-if="!see_all" src="../../static/public/xl.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		name: "spbox",
		props: ['type', 'list', 'status'],
		data() {
			return {
				see_all: false,
				box_height: '140rpx',
			};
		},
		methods: {
			all_click() {
				this.see_all = !this.see_all
				if (this.see_all) {
					this.box_height = 'auto'
				} else {
					this.box_height = '140rpx'
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.spbox {
		.sp_box {
			overflow: hidden;

			.sp_item {
				margin-bottom: 20rpx;

				image {
					width: 134rpx;
					height: 122rpx;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
				}

				.msg {
					flex: 1;
					margin-left: 20rpx;

					.name {
						font-weight: 400;
						font-size: 28rpx;
						color: #666666;
					}

					.gg {
						font-weight: 400;
						font-size: 26rpx;
						color: #999999;
					}
				}

				.price {
					margin-left: 20rpx;
					font-weight: 400;
					font-size: 26rpx;
					color: #666666;
					align-items: flex-end;

					.num {
						margin-top: 10rpx;
						// align-self: flex-end;
					}

					.pl_btn {
						margin-top: 10rpx;
						padding: 6rpx 15rpx;
						background: #EE4133;
						color: #FFFFFF;
						border-radius: 1000rpx;
					}
				}
			}
		}

		.all {
			margin-top: 15rpx;
			font-weight: 250;
			font-size: 28rpx;
			color: #999999;

			image {
				margin-left: 10rpx;
				width: 30rpx;
				height: 30rpx;
			}
		}
	}
</style>